#define  _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>
bool isPalindrome1(int x)
{
    if (x < 0)
        return false;
    int* a = (int*)malloc(sizeof(int) * 1000);
    int b = x;
    int left = 0;
    int right = 0;
    while (b != 0)
    {
        a[right++] = b % 10;
        b /= 10;
    }
    right--;
    while (left < right)
    {
        if (a[left] == a[right])
        {
            left++;
            right--;
        }
        else
            return false;
    }
    return true;

}
bool isPalindrome2(int x)
{
    if (x < 0 || (x % 10 == 0 && x != 0))
        return false;
    int sum = 0;
    while (x > sum)
    {
        sum = sum * 10 + x % 10;
        x /= 10;
    }
    if (sum == x || sum / 10 == x)
        return true;
    return false;
}
int main()
{
    int x = 0;
    scanf("%d", &x);
    isPalindrome1(x);
    isPalindrome2(x);
    return 0;
}